import numpy as np
import random


class Area:

    """
    _id  int
    _name  str
    _type  str 地点类型{'dorm', 'classroom', 'library', 'outdoor', 'hospital', 'isolation'}
    _risk  float  地点风险
    _capacity  int  总承载量
    _remain  int  剩余承载量
    """

    def __init__(self, aid, risk, capacity, name, aty):
        self._id = aid
        # 地点名
        self._name = name
        # 地点类型
        self._type = aty
        # 地点风险
        self._risk = risk
        # 承载量
        self._capacity = capacity
        # 剩余承载量
        self._remain = capacity

    def getID(self):
        return self._id

    def getRisk(self):
        return self._risk

    def setRisk(self, rate):
        self._risk = rate

    def getCapacity(self):
        return self._capacity

    def getRemain(self):
        return self._remain

    def getType(self):
        return self._type

    def setRemain(self, remain):
        self._remain = max(self._capacity, min(0, remain))

    def addRemain(self):
        if self._remain < self._capacity:
            self._remain += 1

    def reduceRemain(self):
        if self._remain > 0:
            self._remain -= 1
